const path = require("path");
const scriptCatWebpackPlugin = require('scriptcat-webpack-plugin');


const d = new Date();

const filename = '调用国开API自动刷课（不答题考试）.user.js';

const scriptConfigs = {
  license: "GPL-3.0",
  author: "i白羽(蜜桃加乌龙)",
  scriptSource: "https://scriptcat.org/script-show-page/986/",
  description: "调用国开API自动刷课（不答题考试） 支持自动访问线上链接、查看资料附件、观看视频、自动查看页面、自动参与发帖回帖。调用API接口实现！",
  namespace: "https://github.com/1665169869/lmsTech",
  version: `${d.getFullYear()}${d.getMonth() + 1}${d.getDate()}${d.getHours()}${d.getMinutes()}`,
  match: [
    "*://lms.ouchn.cn/course/*"
  ],
  notes: [
    "1.2.1：脚本无任何更新，主要是为了更新版本号",
    "1.2.2：修复无法使用的BUG",
    "1.2.3：修复发帖功能无法使用的BUG",
    "1.3.0: 本次更新将会调用学习分析的API请求 这回在学习分析也可以看到学习记录啦!!",
    "1.3.1: 更新版本号",
    "1.3.2: 更新控制台输出颜色",
    "1.3.3: 更新控制台输出背景颜色",
    "1.3.4: 优化部分速度和代码",
    "202310132049: 优化代码，几乎等于重构一次 使用webpack打包，修复部分bug",
    "20231013219: 修复刷视频的时候VideoUploadModel没有正确循环VideoUploadModel.videos的问题",
    "202310132115: 现在整个窗口已经可以用鼠标拖动了"
  ]
}

module.exports = {
  mode: 'development',
  entry: './src/main.js',
  output: {
    filename,
    path: path.resolve(__dirname, 'dist'),
  },
  plugins: [
    new scriptCatWebpackPlugin({
      file: filename,
      name: "调用国开API自动刷课（不答题考试）",
      namespace: scriptConfigs.namespace,
      author: scriptConfigs.author,
      description: scriptConfigs.description,
      version: scriptConfigs.version,
      metadata: {
        icon: ``,
        match: scriptConfigs.match,
        "original-author": scriptConfigs.author,
        "original-license": scriptConfigs.license,
        "original-script": scriptConfigs.scriptSource,
        license: scriptConfigs.license,
        source: scriptConfigs.scriptSource,
        note: scriptConfigs.notes
      }
    })
  ]
}